﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WodLib.Tools
{
    /// <summary>
    /// Claculates average sucesses.
    /// </summary>
    public static class SuccessCalculator
    {
        //10 Agian
        //0,333339283000000
        //9 Agian
        //0,374998516000000
        //8 Agian
        //0,428571146000000
        private const double Again10 = 0.333339283000000;
        private const double Again9 = 0.374998516000000;
        private const double Again8 = 0.428571146000000;

        /// <summary>
        /// Calculates average sucesses count.
        /// </summary>
        /// <param name="dices">Count of dices to roll.</param>
        /// <param name="again">Again rule.</param>
        /// <returns>Average number of sucesses rolled.</returns>
        public static double CalculateAverageSucesses(int dices, AgainRule again)
        {
            switch (again)
            {
                case AgainRule.Again10:
                    return dices * Again10;
                case AgainRule.Again9:
                    return dices * Again9;
                case AgainRule.Again8:
                    return dices * Again8;
                default:
                    return 0;
            }
        }

        public enum AgainRule
        {
            Again10 = 10,
            Again9 = 9,
            Again8 = 8
        }
    }
}
